OBJS = creator.o lex.yy.o y.tab.o vaddr.o
DEPS = $(OBJS:.o=.d)
INC = -I../../include -I.
CFLAGS = -std=c++0x -c $(INC) -g -Wall -fpermissive

all: depend tc

tc: $(addprefix obj/,$(OBJS))
	g++ $^ -o tc -g -Wall

depend: $(addprefix dep/,$(DEPS))
	
obj/%.o : %.cpp
	@mkdir -p obj
	g++ $(CFLAGS) $< -o $@

dep/%.d : %.cpp
	@mkdir -p dep
	g++ $(CFLAGS) $< -MM -MF $@ -MT obj/$*.o


lex.yy.cpp : tc.lex y.tab.cpp
	lex -o $@ $<

y.tab.cpp : tc.y
	bison -d $^ -o $@ --debug --verbose

clean:
	@rm -rf obj dep y.tab.cpp lex.yy.cpp y.tab.hpp tc

#if use relative path strange things occures...
-include $(CURDIR)/dep/*